package com.lyhengtongwl.zqsnews.adapter;

import android.annotation.SuppressLint;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lyhengtongwl.zqsnews.R;
import com.lyhengtongwl.zqsnews.entity.NewsDDDetailEntity;
import com.lyhengtongwl.zqsnews.utils.FTYUtils;

import java.math.BigDecimal;
import java.util.List;

public class NewsDDDetailAdapter extends BaseQuickAdapter<NewsDDDetailEntity, BaseViewHolder> {

    public NewsDDDetailAdapter(List<NewsDDDetailEntity> newsList) {
        super(R.layout.item_pentice_detail, newsList);
    }

    @SuppressLint("SetTextI18n")
    @Override
    protected void convert(BaseViewHolder helper, NewsDDDetailEntity item) {
        ((TextView) helper.getView(R.id.tv_title)).setText(item.getTitle());
        ((TextView) helper.getView(R.id.tv_money)).setText(new BigDecimal(FTYUtils.fenToYuan(item.getMoney())).stripTrailingZeros().toPlainString() + "元");
        //已获得
        //未获得
        if ("1".equals(item.getState())) {
            ((TextView) helper.getView(R.id.tv_state)).setText("已获得");
        } else {
            ((TextView) helper.getView(R.id.tv_state)).setText("未获得");
        }
    }
}
